<template>
  <div class="rightsBox">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/rights' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/rights' }"
        >权限管理</el-breadcrumb-item
      >
      <el-breadcrumb-item :to="{ path: '/rights' }"
        >权限列表</el-breadcrumb-item
      >
    </el-breadcrumb>
    <el-card class="box-card">
      <!-- 用户列表-->
      <el-table :data="tableData" border style="width: 100%  margin-top:10px">
        <el-table-column type="index" label="#" width="100"> </el-table-column>

        <el-table-column
          prop="authName"
          label="权限名称"
          align="left"
       
        >
        </el-table-column>
        <el-table-column prop="path" label="路径"  align="left">
        </el-table-column>
        <el-table-column prop="level" label="权限等级" align="left">
          <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.level == 0">一级</el-tag>
            <el-tag type="waring" v-else-if="scope.row.level == 1">二级</el-tag>
            <el-tag type="danger" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <hr>
  </div>
</template>

<script>
import { getRights } from "../../api/index.js";
export default {
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    this.initGetRights();
  },
  methods: {
    async initGetRights() {
      let {
        data,
        meta: { status },
      } = await getRights({ type: "list" });
      if (status != 200) return this.$message.error("请求失败");
      this.tableData = data;
    },
  },
};
</script>

<style>
.box-card {
  min-width: 1550px;
}
.rightsBox {
  padding-left: 20px;
}

.el-table {
  margin-top: 20px;
}
.el-breadcrumb {
  background-color: #fff !important;
  padding-left: 20px;
}
</style>